import request, {
  Method,
  commonUrl,
  buyerUrl,
  managerUrl,
  expertUrl,
} from "@/plugins/request.js";

// 新增锻炼记录
export function addExerciseRow(data) {
  return request({
    url: `${buyerUrl}/buyer/passport/member/user/saveExerciseRecord`,
    needToken: true,
    method: Method.POST,
    headers: {
      "Content-Type": "application/json",
    },
    data,
  });
}
// 上传图片
export function addExerciseImg(params) {
  return request({
    url: `${commonUrl}/common/common/upload/file`,
    needToken: true,
    method: Method.POST,
    data: params,
  });
}
// 锻炼记录分页
export function getExercisePage(params) {
  return request({
    url: `${buyerUrl}/buyer/passport/member/user/queryExerciseRecord`,
    needToken: true,
    method: Method.POST,
    data: params,
  });
}
//删除锻炼记录
export function delExerciseId(id) {
  return request({
    url: `${buyerUrl}/buyer/passport/member/user/deleteExerciseRecord/${id}`,
    method: Method.DELETE,
    needToken: true,
  });
}

// 实训基地类型列表
export function getBaseTypeList(params) {
  return request({
    url: `${managerUrl}/manager/trainingBase/trainingBase/getTrainingBaseCategory`,
    method: Method.GET,
    needToken: false,
    params,
  });
}

// 实训场地分页
export function getBasePage(data) {
  return request({
    url: `${managerUrl}/manager/trainingBase/trainingBase/pagelist`,
    needToken: true,
    method: Method.POST,
    headers: {
      "Content-Type": "application/json",
    },
    data,
  });
}
// 获取实训基地详情
export function getBaseInfoId(id) {
  return request({
    url: `${managerUrl}/manager/trainingBase/trainingBase/${id}`,
    method: Method.GET,
    needToken: true,
  });
}
// 获取实训基地评价统计
export function getBaseContInfo(id) {
  return request({
    url: `${managerUrl}/manager/trainingBase/trainingBaseEvaluate/getBaseCount/${id}`,
    method: Method.GET,
    needToken: true,
  });
}

// 实训基地评论分页数据
export function getBaseContPage(data) {
  return request({
    url: `${managerUrl}/manager/trainingBase/trainingBaseEvaluate/pagelist`,
    needToken: true,
    method: Method.POST,
    headers: {
      "Content-Type": "application/json",
    },
    data,
  });
}
// 实训基地回复子评论
export function getBaseChildTextId(data) {
  return request({
    url: `${managerUrl}/manager/trainingBase/trainingBaseEvaluate/save`,
    needToken: true,
    method: Method.POST,
    headers: {
      "Content-Type": "application/json",
    },
    data,
  });
}
/**
 * 基地确认预约之后，查看详情
 */
export const baseappointmentDetails=(orderSn)=>{
  return request({
    url: `${buyerUrl}/buyer/order/order/${orderSn}`,
    needToken: true,
    method: Method.GET,
    headers: {
      "Content-Type": "application/x-www-form-urlencoded",
    },
  })
}
// 实训基地-用户确认预约
export function setBaseUserTrue(data) {
  return request({
    url: `${buyerUrl}/buyer/user/userTrainingBase/orderTrainingBase/confirm`,
    needToken: true,
    method: Method.POST,
    headers: {
      "Content-Type": "application/json",
    },
    data,
  });
}
// 实训基地评论点赞
export function setBaseUserPlz(data) {
  return request({
    url: `${managerUrl}/manager/trainingBase/trainingBaseEvaluate/likeOrUnlike`,
    needToken: true,
    method: Method.POST,
    headers: {
      "Content-Type": "application/json",
    },
    data,
  });
}

//课程评论
// 获取课程评价统计
export function getCourseContInfo(id) {
  return request({
    url: `${managerUrl}/courseSeriesBaseEvaluate/getEvaluateCount/${id}`,
    method: Method.GET,
    needToken: true,
  });
}
// 课程评论分页数据
export function getCourseContPage(data) {
  return request({
    url: `${managerUrl}/courseSeriesBaseEvaluate/listByPage`,
    needToken: true,
    method: Method.POST,
    headers: {
      "Content-Type": "application/json",
    },
    data,
  });
}
// 课程评论点赞
export function setCourseUserPlz(data) {
  return request({
    url: `${managerUrl}/courseSeriesBaseEvaluate/likeOrUnlike`,
    needToken: true,
    method: Method.POST,
    headers: {
      "Content-Type": "application/json",
    },
    data,
  });
}
// 课程回复子评论
export function getBaseCourseTextId(data) {
  return request({
    url: `${managerUrl}/courseSeriesBaseEvaluate/save`,
    needToken: true,
    method: Method.POST,
    headers: {
      "Content-Type": "application/json",
    },
    data,
  });
}
// 我的线下预约分页
export function getRegisterpage(data) {
  return request({
    url: `${buyerUrl}/buyer/user/userRegister/pagelist`,
    needToken: true,
    method: Method.POST,
    headers: {
      "Content-Type": "application/json",
    },
    data,
  });
}
// 我的实训预约分页
export function getAppDeailpage(data) {
  return request({
    url: `${buyerUrl}/buyer/user/userTrainingBase/myTrainingOrder`,
    needToken: true,
    method: Method.POST,
    headers: {
      "Content-Type": "application/json",
    },
    data,
  });
}
// 我的实训预约单数据查询
export function getAppDeailId(id) {
  return request({
    url: `${buyerUrl}/buyer/user/userTrainingBase/searchCancel/${id}`,
    method: Method.GET,
    needToken: true,
  });
}
// 我的实训预约-取消预约
export function setAppDeailStatus(data) {
  return request({
    url: `${buyerUrl}/buyer/user/userTrainingBase/cancelOrderBooking`,
    needToken: true,
    method: Method.POST,
    headers: {
      "Content-Type": "application/json",
    },
    data,
  });
}
// 查询场地单条详情
export function getSiteInfoId(id) {
  return request({
    url: `${expertUrl}/expert/site/site/${id}`,
    method: Method.GET,
    needToken: true,
  });
}

// 直播分页
export function getLivePage(params) {
  return request({
    url: `${buyerUrl}/buyer/broadcast/studio/studioList`,
    needToken: true,
    method: Method.GET,
    params: params,
  });
}

// 直播单数据查询
export function getLiveId(id) {
  return request({
    url: `${buyerUrl}/buyer/broadcast/studio/studioById/${id}`,
    needToken: true,
    method: Method.GET,
  });
}
